import javafx.scene.control.SplitPane;
import org.junit.Test;

import java.io.IOException;
import java.sql.*;
import java.util.ServiceLoader;

/**
 * @author ：zzs
 * @version : 1.0
 * @date ：Created in 2022/3/12 9:50
 * @description：
 */
public class JdbcDemo {

    @Test
    public void demo1() throws SQLException, ClassNotFoundException, IOException {
        // 获取连接
        Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/test",
                "root",
                "root");
        PreparedStatement preparedStatement = connection.prepareStatement("select * from teacher");
        ResultSet resultSet = preparedStatement.executeQuery();
        while (resultSet.next()) {
            System.out.println(resultSet.getString("name"));
        }
        preparedStatement.close();
        connection.close();
    }
}
